package com.campus.counseling.controller;

import com.campus.counseling.model.common.Result;
import com.campus.counseling.model.vo.ProblemTypeStatsVO;
import com.campus.counseling.model.vo.CounselorIncomeVO;
import com.campus.counseling.service.AnalysisService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Tag(name = "数据分析")
@RestController
@RequiredArgsConstructor
public class AnalysisController {

    private final AnalysisService analysisService;

    @GetMapping("/api/appointment/consultation-type-stats")
    @Operation(summary = "获取咨询类型统计")
    public Result<Map<String, Object>> getConsultationTypeStats() {
        return Result.success(analysisService.getConsultationTypeStats(null));
    }

    @GetMapping("/api/record/problem-type-stats")
    @Operation(summary = "获取问题类型分布")
    public Result<ProblemTypeStatsVO> getProblemTypeDistribution() {
        return Result.success(analysisService.getProblemTypeDistribution(null));
    }

    @GetMapping("/api/analysis/counselor/income")
    @Operation(summary = "获取咨询师收入数据")
    public Result<List<CounselorIncomeVO>> getCounselorIncome(
            @RequestParam(required = false) String month) {
        return Result.success(analysisService.getCounselorIncome(month, null));
    }
} 